package jy.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Taccount entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "taccount", catalog = "jlubank")
public class Taccount implements java.io.Serializable {

	// Fields

	private String id;
	private Tuser tuser;
	private String name;
	private Integer currency;
	private Integer type;
	private float amount;
	private Date stime;
	private Set<Tdemand> tdemands = new HashSet<Tdemand>(0);
	private Set<Tfixed> tfixeds = new HashSet<Tfixed>(0);
	private Set<Ttraderecord> ttraderecords = new HashSet<Ttraderecord>(0);

	// Constructors

	/** default constructor */
	public Taccount() {
	}

	/** minimal constructor */
	public Taccount(String id, String name) {
		this.id = id;
		this.name = name;
	}

	/** full constructor */
	public Taccount(String id, Tuser tuser, String name, Integer currency,
			Integer type, float amount, Date stime, Set<Tdemand> tdemands,
			Set<Tfixed> tfixeds, Set<Ttraderecord> ttraderecords) {
		this.id = id;
		this.tuser = tuser;
		this.name = name;
		this.currency = currency;
		this.type = type;
		this.amount = amount;
		this.stime = stime;
		this.tdemands = tdemands;
		this.tfixeds = tfixeds;
		this.ttraderecords = ttraderecords;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "uid")
	public Tuser getTuser() {
		return this.tuser;
	}

	public void setTuser(Tuser tuser) {
		this.tuser = tuser;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "currency")
	public Integer getCurrency() {
		return this.currency;
	}

	public void setCurrency(Integer currency) {
		this.currency = currency;
	}

	@Column(name = "type")
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(name = "amount", precision = 12, scale = 0)
	public float getAmount() {
		return this.amount;
	}

	public void setAmount(float amount) {
		this.amount = amount;
	}

	@Column(name = "stime", length = 0)
	public Date getStime() {
		return this.stime;
	}

	public void setStime(Date stime) {
		this.stime = stime;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "taccount")
	public Set<Tdemand> getTdemands() {
		return this.tdemands;
	}

	public void setTdemands(Set<Tdemand> tdemands) {
		this.tdemands = tdemands;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "taccount")
	public Set<Tfixed> getTfixeds() {
		return this.tfixeds;
	}

	public void setTfixeds(Set<Tfixed> tfixeds) {
		this.tfixeds = tfixeds;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "taccount")
	public Set<Ttraderecord> getTtraderecords() {
		return this.ttraderecords;
	}

	public void setTtraderecords(Set<Ttraderecord> ttraderecords) {
		this.ttraderecords = ttraderecords;
	}

}